package blog.service.client.impl;

import blog.dao.back.ConsumerBackMapper;
import blog.dao.client.ConsumerClientMapper;
import blog.entity.Consumer;
import blog.service.back.ConsumerBackService;
import blog.service.client.ConsumerClientService;
import blog.vo.back.*;
import blog.vo.client.AddConsumerVO;
import blog.vo.common.PaginationVO;
import cn.hutool.core.bean.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 　　* @description: TODO
 * 　　* @param
 * 　　* @return
 * 　　* @throws
 * 　　* @author Administrator
 * 　　* @date $ $
 *
 */
@Service
public class ConsumerClientServiceImpl implements ConsumerClientService {
    @Autowired
    private ConsumerClientMapper consumerClientMapper;

    @Override
    public Consumer emailLogin(EmailLoginVO emailLoginVO) {
        Consumer consumer = BeanUtil.copyProperties(emailLoginVO, Consumer.class);
        return consumerClientMapper.emailLogin(consumer);
    }

    @Override
    public Consumer phoneNumberLogin(PhoneNumberLoginVO phoneNumberLoginVO) {
        Consumer consumer = BeanUtil.copyProperties(phoneNumberLoginVO, Consumer.class);
        return consumerClientMapper.phoneNumberLogin(consumer);
    }

    @Override
    public Consumer byConsumerUuidGetConsumerInfo(ByConsumerUuidGetConsumerInfoVO byConsumerNameGetConsumerInfoVO) {
        return consumerClientMapper.byConsumerUuidGetConsumerInfo(byConsumerNameGetConsumerInfoVO.getConsumerUuid());
    }

    @Override
    public String addConsumer(AddConsumerVO addConsumerVO) {
        Consumer consumer = BeanUtil.copyProperties(addConsumerVO, Consumer.class);
        consumerClientMapper.addConsumer(consumer);
        return consumer.getConsumerUuid();
    }

}
